<template>
  <div id="contain"></div>
</template>

<script>
export default {
  data() {
    return {
      token: window.localStorage.getItem("token"),
      orderForm: this.$route.query,
    };
  },
  mounted() {
    this.getPage();
  },

  methods: {
    getPage() {
      this.$axios({
        method: "POST",
        url: "/alipay/in",
        headers: { token: this.token },
        data: this.orderForm,
      }).then((response) => {
        const data = response.data;
        if (data.code !== 0) {
          this.$message.error(data.msg);
          return false;
        }
        const divPay = document.getElementById("contain");
        divPay.innerHTML = data.page;
        document.forms[0].submit();
        return true;
      });
    },
  },
};
</script>

<style lang="css" scoped></style>
